package org.example.chapter3_3.service.iml;

import org.example.chapter3_3.entity.User;
import org.example.chapter3_3.mapper.UserMapper;
import org.example.chapter3_3.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceIml  implements UserService {
    @Autowired
    UserMapper userMapper;
    @Override
    public int registerUser(User user) {
        if(userMapper.findUserByName(user)!=0){
            throw new RuntimeException("账号已存在");
        }
        return userMapper.createUser(user);
    }


}
